<template>
    <div class="platformTemp">
        <el-form class="formBox" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="true"
            label-width="68px">

                <el-form-item label="专病名称" prop="diseaseClassifyName">
                    <el-input v-model="queryParams.diseaseClassifyName" placeholder="请输入专病名称" clearable style="width: 160px"
                        @keyup.enter.native="handleQuery" />
                </el-form-item>

            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <div style="margin-bottom: 20px">
            <el-button @click="comfirm()" type="success" size="mini" icon="el-icon-plus" plain
                :disabled="multiple">批量引用</el-button>
        </div>
        <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
            @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column type="index" width="50">
            </el-table-column>
            <el-table-column prop="name" label="名称" width="200">
            </el-table-column>
            <el-table-column prop="type" label="类型" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="remark" label="备注" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="日期" width="120">
                <template slot-scope="scope">{{ scope.row.date }}</template>
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button size="mini" type="success" @click="handleEdit(scope.$index, scope.row)">引用</el-button>
                </template>
            </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
    </div>
</template>

<script>
import { listClassify } from "@/api/system/classify";
export default {
    name: "platformTemp",
    dicts: [
        'sys_plan_category'
    ],
    props: ['type'],//type 1表单  2 单项  3专病   4 设备  5 检测指标  6 文本
    data() {
        return {
            // 专病管理列表
            classifyList: [],
            tableData: [{
                date: '2016-05-03',
                name: 'xxx',
                type: '****'
            }, {
                date: '2016-05-02',
                name: 'xxx',
                type: '****'
            }, {
                date: '2016-05-04',
                name: 'xxx',
                type: '****'
            }, {
                date: '2016-05-01',
                name: 'xxx',
                type: '****'
            }, {
                date: '2016-05-08',
                name: 'xxx',
                type: '****'
            }, {
                date: '2016-05-06',
                name: 'xxx',
                type: '****'
            }, {
                date: '2016-05-07',
                name: 'xxx',
                type: '****'
            }],
            multipleSelection: [],
            // 非多个禁用
            multiple: true,
            total: 7,
            queryParams: {
                diseaseId: undefined,
                planCategoryId: undefined,
                medicalEquipment: undefined,
                pageNum: 1,
                pageSize: 10
            }
        }
    },
    mounted() {
        this.getClassifyList()
    },
    beforeDestroy() {

    },
    methods: {
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.queryParams = {
                diseaseId: undefined,
                planCategoryId: undefined,
                medicalEquipment: undefined,
                pageNum: 1,
                pageSize: 10
            }
            this.resetForm("queryForm");
        },
        /** 查询专病列表 */
        getClassifyList() {
            listClassify(
                {
                    pageNum: 1,
                    pageSize: 9999,
                    status: '0',
                }
            ).then((response) => {
                this.classifyList = response.rows;

            });
        },
        getList() {

        },
        toggleSelection() {
            this.$refs.multipleTable.clearSelection();
        },
        handleEdit(index, row) {
            console.log(index, row);
        },
        handleSelectionChange(selection) {
            this.multipleSelection = selection;
            this.multiple = !selection.length;
        },
        comfirm() {

        }
    },

}
</script>

<style scoped   lang="scss">

</style>
